import java.util.Arrays;
import java.util.Scanner;
import java.lang.StringBuilder;

public class test {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        int count = 0;
        for (int i = 0,j=1; i < str.length()&&j<=str.length(); j++) {
            StringBuilder s = new StringBuilder();
            for (int k = i; k <j; k++) {
                s.append(str.charAt(k));
            }
            String str2 = s.toString();
            if(str2.contains("r")&&str2.contains("e")&&!str2.contains("d")){
                count++;
                if(str.charAt(i)!='r'&&str.charAt(i)!='e'){
                    i++;
                    j = i+1;
                }
            }
            if (str.charAt(j-1) == 'd') {
                i = j;
            }
        }
        System.out.println(count);
    }
}

